home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS5.ZIP / DOSPRINT < prev    next >
Text File  |  1987-10-18  |  8KB  |  209 lines

  1.                           PrtSc Toggler
  2.              (PC Magazine August 1986 User-to-User)
  3.  
  4.      If you hit Shift-PrtSc accidentally when your printer is on, you
  5. have to wait until it finishes typing the screen and then readjust the
  6. paper to the top of the next page.  If it's off, your system will hang
  7. until DOS realizes that the printer is not going to respond.
  8.      When you hit Shift-PrtSc, DOS issues Interrupt 5, which first
  9. looks at a location in low memory called STATUS_BYTE to see whether
  10. your system is already dumping a screen to the printer.  If STATUS_BYTE
  11. is equal to 1, DOS thinks a screen dump is taking place and exits the
  12. routine without dumping another screen to the printer.  If STATUS_BYTE
  13. is equal to 0, the routine sets STATUS_BYTE to 1 so that it cannot
  14. interrupt itself, then does the actual dump, and finally resets STATUS
  15. _BYTE equal to 0 and exits the routine.
  16.      This means you can disable the Shift-PrtSc routine with a simple
  17. assembly language routine, DISABLE.COM, which sets STATUS_BYTE to 1.
  18. A similar routine, ENABLE.COM, can turn it back on by setting STATUS
  19. _BYTE to 0.  You can create both files in DOS using the DEBUG version
  20. or in BASIC using PRTSCTOG.BAS below.
  21.  
  22.      Create the following with an ASCII word processor and give it the
  23. filename SCRIPT.  Put the file on the same disk with DEBUG.COM and type
  24. DEBUG<SCRIPT.
  25.  
  26. N DISABLE.COM
  27. A 100
  28. PUSH DS
  29. MOV AX,0050
  30. MOV DS,AX
  31. MOV BYTE PTR [0000],01
  32. POP DS
  33. INT 20
  34.  
  35. RCX
  36. E
  37. W
  38. N ENABLE.COM
  39. E 10A 0
  40. W
  41. Q
  42. - - - - -
  43.  
  44. 100 'PRTSCTOG.BAS
  45. 110 OPEN "R",1,"DISABLE.COM",1:FIELD #1,1 AS A$
  46. 120 FOR X=1 TO 14:READ CHAR:LSET A$=CHR$(CHAR)
  47. 130 PUT #1,X:NEXT:CLOSE:RESTORE
  48. 140 OPEN "R",1,"ENABLE.COM",1:FIELD #1,1 AS A$
  49. 150 FOR X=1 TO 14:READ CHAR:IF X=11 THEN CHAR=0
  50. 160 LSET A$=CHR$(CHAR):PUT #1,X:NEXT:CLOSE
  51. 170 DATA 30,184,80,0,142,216,198,6,0,0,1,31,205,32
  52.  
  53. -----------------------------------------------------------------
  54.                    Resident Form-Feed Program
  55.                (PC Magazine August 1986 PC Tutor)
  56.  
  57.      FORMFEED.COM is a memory-resident program that provides a printer
  58. form-feed key (Alt-PrtSc) on the PC keyboard.  FORMFEED.COM does not
  59. clear the keystroke from the keyboard hardware but just branches to
  60. the previous Interrupt 9 keyboard handler after it's done.  Thus, if
  61. you load FORMFEED twice, you'll get two form-feeds with an Alt-PrtSc.
  62. Before writing the form-feed character (a hex )Ch) out to the printer,
  63. FORMFEED does a printer status call to Interrupt 17h, so it doesn't
  64. hang if the printer is off-line.
  65.      You can either load DEBUG and type the lines as shown below, or
  66. you can type the lines into an ASCII file called FORMFEED.SCR and run:
  67.  
  68. DEBUG <FORMFEED.SCR
  69.  
  70. Be sure to include the blank line (that is, a carriage return by
  71. itself) shown near the bottom.
  72.  
  73. N FORMFEED.COM
  74. A
  75. JMP   0103         ;Jump to Init
  76. DW    0,0
  77. STI                ;New Int 9
  78. PUSH  AX
  79. IN    AL,60        ;Get key
  80. CMP   AL,37        ;See if PrtSc
  81. JNZ   012A
  82. MOV   AH,02        ;Check for Alt
  83. INT   16
  84. TEST  AL,08
  85. JZ    012A
  86. PUSH  DX
  87. MOV   DX,0000      ;Check printer
  88. MOV   AH,02        ;  status
  89. INT   17
  90. TEST  AH,80
  91. JZ    0129
  92. MOV   AL,0C        ;Print formfeed
  93. MOV   AH,00
  94. INT   17
  95. POP   DX
  96. POP   AX
  97. CS:
  98. JMP   FAR [0102]   ;Run old Int 9
  99. MOV   AX,3509      ;Init: save
  100. INT   21           ;  Int 9
  101. MOV   [0102],BX
  102. MOV   [0104],ES
  103. MOV   DX,0106      ;Set new
  104. MOV   AX,2509      ;  Int 9
  105. INT   21
  106. MOV   DX,0130
  107. INT   27           ;Terminate
  108.  
  109. R CX
  110. 4A
  111. W
  112. Q
  113.  
  114. -----------------------------------------------------------------
  115.                        Double Printer Duty
  116.        (PC Magazine Vol 5 No 18 Sept 16, 1986 PC Advisor)
  117.  
  118.      The problem:  How to get one printer to run from the mono/parallel
  119. port and another, different printer to run from the AST SixPak parallel
  120. port while allowing AST's SuperSpool to work properly.
  121.      The solution:  SuperSpool needs a patch to make it switch between
  122. parallel ports (see below).  However, to make the switch you need to
  123. quit your application and run a batch file, which may interfere with
  124. some memory-resident programs.
  125.      Move convenient would be an A-B switch (less than $100 from mail-
  126. order houses) that you run out of LPT1 and connect to both printers;
  127. choosing a printer is then as easy as flipping a switch.  A print
  128. spooler that can accommodate two printers will give you the same
  129. convenience and provide the added benefit of freeing up the RAM your
  130. software buffer is using.
  131.  
  132. - - - - -
  133.                 Swapping Printers with AST Cards
  134.         (PC Magazine Vol 4 No 3 Feb 5, 1985 User-to-User)
  135.  
  136.      When SuperSpool is installed at bootup, it prevents output to any
  137. printer but the one you've originally specified.  If you've set
  138. SuperSpool to use LPT1, you're shut out of LPT2.
  139.      Create the batch file LPTSWAP.BAT.  Also create the file SWAP.BAS.
  140. Make sure both files are in your current directory along with MODE.COM,
  141. BASICA.COM, and SUPERSPL.COM.  Enter LPTSWAP at the DOS prompt, and
  142. normal printer output will be routed to LPT2.  Do it again, and you're
  143. back to LPT1.  (This clobbers SideKick.)
  144.  
  145. LPTSWAP.BAT:
  146.  
  147. SUPERSPL/P
  148. SUPERSPL LPT2:
  149. MODE LPT1:
  150. MODE LPT2:
  151. BASICA SWAP
  152. SUPERSPL LPT1:
  153.  
  154.  
  155. SWAP.BAS:
  156.  
  157. 10 DEF SEG=&H40
  158. 20 A=PEEK(8):B=PEEK(9)
  159. 30 POKE 8,PEEK(10):POKE 9,PEEK(11)
  160. 40 POKE 10,A:POKE 11,B
  161. 50 SYSTEM
  162.  
  163. -----------------------------------------------------------------
  164.                        ANSI on the Printer
  165.          (PC Magazine Vol 5 No 19 Nov 11, 1986 PC Tutor)
  166.  
  167.      In using ANSI.SYS and the PROMPT command to set screen colors,
  168. an AUTOEXEC.BAT contains the following command:
  169.  
  170. PROMPT $e[35;44;1m$p$g$e[33;44;1m
  171.  
  172. Aside from the colors, the prompt now shows the current drive and
  173. directory.  A problem arises when toggling the printer echo with
  174. Ctrl-PrtSc -- to print a DIR listing, for example.  Part of the
  175. string that follows the PROMPT command gets printed instead of the
  176. prompt on the screen.
  177.      The way to fix this is don't use printer echo.  Use redirection
  178. of output instead.  When you want to print a DIR listing, simply
  179. execute:
  180.  
  181. DIR > PRN
  182.  
  183. Or you could put the PROMPT command in its own separate batch file
  184. (say PR.BAT) and issue a PROMPT without any parameters before toggling
  185. printer echo.  This returns your prompt to normal before you print.
  186. Then, after you've toggle printer echo off, execute PR.
  187.      Although the problem of echoing the ANSI prompt on the printer
  188. looks a little strange when you first see it (because what you see
  189. being printed is not what you see on the screen), it's really fairly
  190. simple.  COMMAND.COM is in charge of displaying the DOS prompt.  The
  191. prompt it tells DOS to display looks much like the string that follows
  192. the PROMPT command, except that COMMAND.COM substitutes the ASCII
  193. Escape code (27 or 1B in hex) for the $e, the current subdirectory
  194. for $p, and the right angle bracket for $g.
  195.      COMMAND sends the string to DOS, and DOS sends the string to the
  196. device driver ANSI.SYS to be displayed to the screen.  ANSI.SYS
  197. recognizes the two strings that begin with an Escape code as control
  198. sequences.  It doesn't display them but instead does something else.
  199. (In this case above, it changes the screen color, for example.)
  200. However, when you have printer echo toggled on, DOS blindly sends the
  201. same string out to the printer.  Your printer gobbles up the Escape
  202. code and probably the left bracket also, but then gives up and prints
  203. the rest of it as is.
  204.      Some PC printers actually respond to ANSI control sequences.
  205. However, since IBM's control sequence to change colors is not part of
  206. the standard ANSI control sequence set, these printers, too, would
  207. probably not respond well to the prompt you're using.
  208.  
  209.